<?php

session_set_cookie_params(0, NULL, NULL, NULL, TRUE); //http only cookie
session_start();

if(!isset($_SESSION['isLogged']) || $_SESSION['isLogged'] != true) header('Location: index.php');

require 'includes/common.php';

$selectedItem = (int)$_GET['item'];

if ( !isset($selectedItem) || !is_numeric($selectedItem) || $selectedItem < 0 ) {
    header('Location:admin.php');
    exit();
}

//CHECK MALE OR FEMALE ITEM
if ((int)$selectedItem > 299) {
    unlink($pics_women[$selectedItem]['loc_big']);
    unlink($pics_women[$selectedItem]['loc_small']);
    $delete_txt = str_replace("../","",$path_txt_w.$pics_women[$selectedItem]['en_name'].'.txt');
    unlink($delete_txt);
} else {
    unlink($pics_men[$selectedItem]['loc_big']);
    unlink($pics_men[$selectedItem]['loc_small']);
    $delete_txt = str_replace("../","",$path_txt.$pics_men[$selectedItem]['en_name'].'.txt');
    unlink($delete_txt);
}

$pageTitle="File Upload System: DELETE";
include 'includes/header_admin.php';
?>

    <br/><br/><p>Успешно изтрихте файла.</p>
    <a href="admin.php">Върни се обратно</a>

<?php echo '<br/></div></body></html>'; ?>